<template>
  <!--物资二维码标签重新生成弹窗-->
  <px-dialog v-model="visible" title="物资二维码标签重新生成" width="1200px" destroy-on-close append-to-body inline @close="handleCancel">
    <div class="descriptions-box">
      <p>说明：</p>
      <ul>
        <li>1. 该功能用于对物资标签的批量重新生成；</li>
        <li>2. 重新生成标签时间较长，执行重新生成命令后12小时全部更新完毕。</li>
      </ul>
    </div>
    <template #footer>
      <div class="dialog-footer">
        <px-button @click="handleCancel">取 消</px-button>
        <px-button type="primary" @click="handleSubmitAuditForm()">确 定</px-button>
      </div>
    </template>
  </px-dialog>
</template>

<script lang="ts" setup>
import { batchCreateEqpImgs } from "@/api/erc/material";
import { PxMessage } from "px-ui";
import { computed } from "vue";
// 调用父级-返回主页、查询列表方法
const emits = defineEmits(["closeDialog"]);
// 父级传过来的值
const props = defineProps(["visible"]);

const visible = computed(() => props.visible);

const handleCancel = () => {
  emits("closeDialog");
};

/** 提交按钮 */
const handleSubmitAuditForm = async () => {
  try {
    await batchCreateEqpImgs();
    PxMessage.success("设备二维码标签重新生成中，请耐心等待");
    handleCancel();
  } catch {}
};
</script>

<style lang="scss" scoped>
.descriptions-box {
  display: flex;
  flex-direction: row;
  margin-left: 56px;
  font-size: 15px;
  color: #666;
}

:deep(.select-trigger) {
  width: 250px;
}
</style>
